﻿using System;
using System.Web.Mvc;

namespace MvcTemplates
{
    public class CloneableTagBuilder : TagBuilder, ICloneable
    {
        public CloneableTagBuilder( string tagName ) : base( tagName )
        {
        }

        public object Clone()
        {
            var clone = new CloneableTagBuilder( this.TagName );
            clone.IdAttributeDotReplacement = this.IdAttributeDotReplacement;
            clone.InnerHtml = this.InnerHtml;
            foreach( var attr in this.Attributes )
            {
                clone.Attributes.Add( attr.Key, attr.Value );
            }
            return clone;
        }
    }
}